//*************************************************************************//
//*           _____   ____________            ______               __     *//
//*          / /__ \ / ____/ ____/           / ____/___  _________/ /     *//
//*     __  / /__/ // __/ / __/    ______   / /_  / __ \/ ___/ __  /      *//
//*    / /_/ // __// /___/ /___   /_____/  / __/ / /_/ / /  / /_/ /       *//
//*    \____//____/_____/_____/           /_/    \____/_/   \__,_/        *//
//*                                                                       *//
//*     Copyright (c) 2006 Ford Argentina. All Rights Reserved.           *//
//*                                                                       *//
//*************************************************************************//

package ar.com.ford.it.webengine.wslx;

import java.util.ArrayList;
import java.util.List;
import com.ford.it.logging.ILogger;
import com.ford.it.logging.LogFactory;

/**
 * WslxUser <br>
 * WslxUser base para la extension segun necesidades de seguridad de cada aplicacion
 * 
 * @author Aji
 */
public abstract class WslxUser {
	
    protected String id;
    
    protected List permissions;
    protected List profiles;
    protected List menuAccess;
    protected List fullPermissions;

    private static final String CLASS_NAME = WslxUser.class.getName();
    private static final ILogger log = LogFactory.getInstance().getLogger(CLASS_NAME);

	/**
	 * Constructor WslxUser <br>
	 * Devuelve una instancia de WslxUser
	 */
    public WslxUser(String userId) {
        String METHOD_NAME = "WslxUser";
       	log.entering(CLASS_NAME, METHOD_NAME, userId);

        this.id = userId;
        
        log.exiting(CLASS_NAME, METHOD_NAME);
    }

	
	/**
	 * Metodo getId.
	 * @return Id del usuario
	 */
    public String getId() {
        return id;
    }

	/**
	 * Metodo getPermissions.
	 * @return Lista de permisos
	 */
    public List getPermissions() {
        return permissions;
    }

	/**
	 * Metodo getProfiles.
	 * @return Lista de perfiles
	 */
    public List getProfiles() {
        return profiles;
    }

	/**
	 * Metodo getMenuAccess.
	 * @return Lista de permisos de acceso al menu
	 */
    public List getMenuAccess() {
        return menuAccess;
    }


	/**
	 * Metodo getFullPermissions.
	 * @return Lista con todos los permisos, de accion y de menu
	 */
	public List getFullPermissions() {
		if (this.fullPermissions == null) {
			this.fullPermissions = new ArrayList();
			
	        if (this.permissions != null && !this.permissions.isEmpty())
	        	fullPermissions.addAll(this.permissions);
	        
	        if (this.menuAccess !=null && !this.menuAccess.isEmpty())
	        	fullPermissions.addAll(this.menuAccess);
		}
		
		return fullPermissions;
	}


	public void setMenuAccess(List menuAccess) {
		this.menuAccess = menuAccess;
	}


	public void setPermissions(List permissions) {
		this.permissions = permissions;
	}


	public void setProfiles(List profiles) {
		this.profiles = profiles;
	}

}